package main

import (
	"log"
	"net"
)

func main() {
	listener, err := net.Listen("tcp", ":20010")
	if err != nil {
		log.Fatalln(err.Error())
	}
	defer listener.Close()
	for {
		conn, err := listener.Accept()
		if err != nil {
			log.Println(err.Error())
			continue
		}
		go func(conn net.Conn) {
			defer func() {
				if err := conn.Close(); err != nil {
					log.Println(err.Error())
				}
			}()
			log.Printf("local addr: %s, remote addr: %s", conn.LocalAddr(), conn.RemoteAddr())
		}(conn)
	}
}



